header
  • prevSection
  • prev
  • nextSection
  • Navigation Arrow
  • SQL
  • Navigation Arrow
  • DML
  • Navigation Arrow
  • Updating Table Properties

Data Manipulation Language (DML)

Updating Table Properties

Let’s look at that first. The syntax for updating the properties of a table in MySQL is

UPDATETableName
SETcolumnName1=dataValue1 [,columnName2=dataValue2…]
[WHEREsearchCondition]

A simple implementation of the insert statement would be

UPDATEstudents
SETstudent_id=student_id+100

As you can see from the above example, all students will have their student ID’s incremented by 100. Note that the WHERE clause is optional where the update applies to all rows in the table.

A more advanced example would contain a WHERE clause, an example of this follows

UPDATEstudents
SETfirst_name=’kevin’
[WHEREstudent_id = 101;

The above example modifies the name of the student whose student id is 101, to Kevin.

  • prevSection
  • prev
  • nextSection
  • Navigation Arrow
  • SQL
  • Navigation Arrow
  • DML
  • Navigation Arrow
  • Updating Table Properties